package com.ruoyi.business.service.impl;


import com.alibaba.fastjson2.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.business.domain.ReceivingNote;
import com.ruoyi.business.mapper.ReceivingNoteMapper;
import com.ruoyi.business.service.ReceivingNoteService;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * 原材料收货通知单Service业务层处理
 *
 * @author ruoyi
 * @date 2024-07-30
 */
@Service
public class ReceivingNoteServiceImpl extends ServiceImpl<ReceivingNoteMapper, ReceivingNote> implements ReceivingNoteService {
    @Override
    public List<ReceivingNote> queryList(ReceivingNote receivingNote) {
        QueryWrapper<ReceivingNote> queryWrapper = Wrappers.query();
        if (StringUtils.isNotEmpty(receivingNote.getStatus().toString())) {
            queryWrapper.eq("status", receivingNote.getStatus());
        }
        if (receivingNote.getBiztime() != null) {
            queryWrapper.eq("biztime", DateUtils.dateTime(receivingNote.getBiztime()));
        }
        if (receivingNote.getCreateTime() != null) {
            queryWrapper.eq("create_time", DateUtils.dateTime(receivingNote.getCreateTime()));
        }

        return this.list(queryWrapper);
    }
}

